package com.example.redis6.dao;

import com.example.redis6.model.VideoCardDo;
import com.example.redis6.model.VideoDo;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * description: VideoDao <br>
 * date: 2021/7/20 09:08 <br>
 *
 * @author: ZhangYixin <br>
 * version: 1.0 <br>
 */
@Component
public class VideoCardDao {

    public List<VideoCardDo> list(){
        try {
            TimeUnit.MILLISECONDS.sleep(200L);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        List<VideoCardDo> videocardList = new ArrayList<>();

        VideoCardDo videoCardDo1 = new VideoCardDo();
        VideoDo videoDo1 = new VideoDo(1,"title1","image1",9);
        VideoDo videoDo2 = new VideoDo(2,"title2","image2",19);
        VideoDo videoDo3 = new VideoDo(3,"title3","image3",29);
        VideoDo videoDo4 = new VideoDo(4,"title4","image4",39);

        videoCardDo1.setId(1);
        videoCardDo1.setTitle("测试1");

        // 组装list
        List<VideoDo> videoDos1 = new ArrayList<>(4);
        videoDos1.add(videoDo1);
        videoDos1.add(videoDo2);
        videoDos1.add(videoDo3);
        videoDos1.add(videoDo4);

        videoCardDo1.setVideoList(videoDos1);
        videoCardDo1.setWeight(23);

        VideoCardDo videoCardDo2 = new VideoCardDo();
        VideoDo videoDo5 = new VideoDo(11,"title11","image11",29);
        VideoDo videoDo6 = new VideoDo(12,"title12","image12",219);
        VideoDo videoDo7 = new VideoDo(13,"title13","image13",229);
        VideoDo videoDo8 = new VideoDo(14,"title14","image14",239);

        videoCardDo2.setId(2);
        videoCardDo2.setTitle("测试2");

        // 组装list
        List<VideoDo> videoDos = new ArrayList<>(4);
        videoDos.add(videoDo5);
        videoDos.add(videoDo6);
        videoDos.add(videoDo7);
        videoDos.add(videoDo8);

        videoCardDo2.setVideoList(videoDos);
        videoCardDo2.setWeight(26);

        videocardList.add(videoCardDo1);
        videocardList.add(videoCardDo2);

        return videocardList;

    }

}
